//
//  NSDictionary+CLCategory.h
//  CLBrowser
//
//  Created by 梁慧聪 on 2021/7/9.
//

#import <Foundation/Foundation.h>

NS_ASSUME_NONNULL_BEGIN

@interface NSDictionary (CLCategory)
/**
Dictionary预处理

 @param key 键名
 @return 键值
 */
- (id)cl_objectForKey:(NSString *)key;
/**
 Dictionary预处理

 若键值为nil，使用nil默认值
 
 @param key 键名
 @param value nil默认值
 @return 键值
 */
- (id)cl_objectForKey:(NSString *)key defaultValue:(id)value;
- (NSString *)cl_toJsonString;
+ (instancetype)cl_dictionaryWithJSONString:(NSString *)JSONString;
- (NSArray *)cl_arrayForKey:(NSString *)key;
- (NSDictionary *)cl_dictionaryForKey:(NSString *)key;
- (NSString *)cl_stringForKey:(NSString *)key;
- (NSNumber *)cl_numberForKey:(NSString *)key;
- (NSDate*)cl_dateForKey:(NSString*)key andFormat:(NSString*) format;
@end

@interface NSMutableDictionary (Category)
- (void)cl_setObjectSafe:(id)anObject forKey:(id<NSCopying>)aKey;
@end
NS_ASSUME_NONNULL_END
